﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BhvPin : MonoBehaviour
{

    public Transform target;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    public void Pin(Transform trans){
        target = trans;
    }

    public void UnPin(){
        target = null;
    }

    // Update is called once per frame
    void Update()
    {
        if(!target)return;
        if(!transform.gameObject.activeInHierarchy)return;
        transform.position = target.position;
    }

    private void OnDestroy() {
        target = null;
    }

}
